package cn.stacey.offer01;

//请实现一个函数，将一个字符串中的空格替换成“%20”。例如，当字符串为We Are Happy.则经过替换之后的字符串为We%20Are%20Happy。
public class Solution11 {
  public static String replaceSpace(StringBuffer str) {
        String str1=str.toString();  
        String str2=str1.replace(" ","%20");  
        return str2;  

  }

  public static void main(String[] args) {

      System.out.println(replaceSpace(new StringBuffer("We Are Happy.")));
  }
}